export const ADD_TODO = "ADD_TODO";
export const DELETE_TODO = "DELETE_TODO";
export const TOGGLE_TODO = "TOGGLE_TODO";
export const EDIT_TODO = "EDIT_TODO"

export const addTodo = (text: string) => ({
    type: ADD_TODO,
    payload: { id: Date.now(), text }
})

export const deleteTodo = (id: number) => ({
    type: DELETE_TODO,
    payload: { id }
})

export const toggle_todo = (id: number) => ({
    type: TOGGLE_TODO,
    payload: { id }
})

export const editTodo = (id: number, text: string) => ({
    type: EDIT_TODO,
    payload: { id, text }
})